﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameLogic
{
	public class Option
	{
		public const string TrainSwordman = "TrainSwordman";
		public const string TrainPoleAxeMan = "TrainPoleAxeMan";

		private delegate void makeAction(Building building);

		private Dictionary<String, makeAction> options = new Dictionary<string, makeAction>();
		private string selectedFunction;

		public Option(string function)
		{
			options[TrainSwordman] = trainSwordman;
			options[TrainPoleAxeMan] = trainPoleAxeMan;

			selectedFunction = function;
		}

		public String getRepresentationURI()
		{
			return "Default";
		}

		public void ExecuteAction(Building building)
		{
			options[selectedFunction](building);
		}

		private void trainSwordman(Building building)
		{
			((Barracks)building).train(new Swordsman());
		}

		private void trainPoleAxeMan(Building building)
		{
			((Barracks)building).train(new PoleAxeMan());
		}
	}
}
